<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html" ;charset="gb2312">
<title>CoolMeeting会议管理系统</title>
<link rel="stylesheet" href="styles/common.css" />
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
	//页面加载后，ajax异步刷出部门和角色
	
	
	
	function checkPwd() {
		var pwd = $('[name=userpwd]').val();
		var comPwd = $('#confirm').val();
		if (pwd == comPwd) {
			return true;
		} else {
			alert('两次密码内容不一致！')
			return false;
		}
	}
	$(function() {
		$('#confirm').blur(checkPwd);
		$('[type=submit]').click(checkPwd);
	});
</script>
<script type="text/javascript">
	//页面加载成功后  会执行$()里面的匿名函数
	$(function(){
		//向后台发送异步请求，接收响应结果
		$.ajax({
			type:"get",
			url:"selectDeptsAndRoles",
			dataType:"json",
			success:function(data){
				//后台成功响应后  data是接收到的后台响应数据  刷新页面上的部门和角色的下拉选项
				$("select[name=departmentid]").empty();
				$.each(data.depts,function(i,dept){
					var optionNode='<option value="'+dept.departmentid+'">'+dept.departmentname+'</option>';
					$("select[name=departmentid]").append(optionNode);
				});
				//为角色下拉选项动态生成数据
				$("select[name=roleid]").empty();
				$.each(data.roles,function(i,role){
					var optionNode='<option value="'+role.roleid+'">'+role.rolename+'</option>';
					$("select[name=roleid]").append(optionNode);
				});
			},
			error:function(request){
				//输出错误的状态码
				alert(request.status);
			}
		});
	});
</script>
</head>
<body>
	<div class="page-header">
		<div class="header-banner">
			<img src="images/header.png" alt="CoolMeeting" />
		</div>
		<div class="header-title">欢迎访问Cool-Meeting会议管理系统</div>
		<div class="header-quicklink">
			欢迎您，<strong>${emp.employeename }</strong> <a href="changepassword.html">[修改密码]</a>
		</div>
	</div>
	<div class="page-body">
		<div class="page-sidebar">
			<div class="sidebar-menugroup">
				<div class="sidebar-grouptitle">个人中心</div>
				<ul class="sidebar-menu">
					<li class="sidebar-menuitem"><a href="notifications.jsp">最新通知</a></li>
					<li class="sidebar-menuitem active"><a href="myOrderMeeting">我的预定</a></li>
					<li class="sidebar-menuitem"><a href="mymeetings.html">我的会议</a></li>
				</ul>
			</div>
			<div class="sidebar-menugroup">
				<div class="sidebar-grouptitle">人员管理</div>
				<ul class="sidebar-menu">
					<li class="sidebar-menuitem"><a href="selectAllDepts">部门管理</a></li>
					<li class="sidebar-menuitem"><a href="register.jsp">员工注册</a></li>
					<li class="sidebar-menuitem"><a href="selectApproveAccount">注册审批</a></li>
					<li class="sidebar-menuitem"><a
						href="searchEmployees?employeestatus=1">搜索员工</a></li>
				</ul>
			</div>
			<div class="sidebar-menugroup">
				<div class="sidebar-grouptitle">会议预定</div>
				<ul class="sidebar-menu">
					<li class="sidebar-menuitem"><a href="addmeetingroom.jsp">添加会议室</a></li>
					<li class="sidebar-menuitem"><a href="selectMeetingRoom">查看会议室</a></li>
					<li class="sidebar-menuitem"><a href="bookmeeting.jsp">预定会议</a></li>
					<li class="sidebar-menuitem"><a href="selectMeetingPage">搜索会议</a></li>
				</ul>
			</div>
		</div>
		<div class="page-content">
			<div class="content-nav">人员管理 > 员工注册</div>
			<form action="insertEmp">
				<fieldset>
					<legend>员工信息</legend>
					<table class="formtable" style="width: 50%">
						<tr>
							<td>姓名：</td>
							<td><input type="text" name="employeename" maxlength="20" /></td>
						</tr>
						<tr>
							<td>账户名：</td>
							<td><input type="text" name="username" maxlength="20" /></td>
						</tr>
						<tr>
							<td>密码：</td>
							<td><input type="password" name="userpwd" maxlength="20"
								placeholder="请输入6位以上的密码" /></td>
						</tr>
						<tr>
							<td>确认密码：</td>
							<td><input type="password" id="confirm" maxlength="20" /></td>
						</tr>
						<tr>
							<td>所属部门：</td>
							<td><select name="departmentid"></select></td>
						</tr>
						<tr>
							<td>选择角色：</td>
							<td><select name="roleid"></select></td>
						</tr>
						<tr>
							<td>联系电话：</td>
							<td><input type="text" name="phone" maxlength="20" /></td>
						</tr>
						<tr>
							<td>电子邮件：</td>
							<td><input type="text" name="email" maxlength="20" /></td>
						</tr>
						<tr>
							<td colspan="6" class="command"><input type="submit"
								class="clickbutton" value="注册" /> <input type="reset"
								class="clickbutton" value="重置" /></td>
						</tr>
					</table>
				</fieldset>
			</form>
		</div>
	</div>
	<div class="page-footer">
		<hr />
		更多问题，欢迎联系<a href="mailto:webmaster@eeg.com">管理员</a> <img
			src="images/footer.png" alt="CoolMeeting" />
	</div>
</body>
</html>